package dev.huidocs.docs.service.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.Objects;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import javax.validation.constraints.*;
import com.gitee.coadmin.base.BaseDto;

/**
 * Resources
 * @author jinjin
 * @since 2024-10-11
 */
@Getter
@Setter
@NoArgsConstructor
public class DocResDTO extends BaseDto {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "ID")
    @Excel(name = "ID")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "父级ID(0表示没有父级)")
    @Excel(name = "父级ID(0表示没有父级)")
    @NotNull
    @JsonSerialize(using= ToStringSerializer.class)
    private Long pid;

    @ApiModelProperty(value = "文档对外展示ID(比如URL中)")
    @Excel(name = "文档对外展示ID(比如URL中)")
    @NotBlank
    private String recordId;

    @ApiModelProperty(value = "资源大类1=目录 10=文档 250=其他文件")
    @Excel(name = "资源大类1=目录 10=文档 250=其他文件")
    @NotNull
    private Integer category;

    @ApiModelProperty(value = "文件路径")
    @Excel(name = "文件路径")
    @NotBlank
    private String filePath;

    @ApiModelProperty(value = "文件名（不含扩展名，不含路径）")
    @Excel(name = "文件名（不含扩展名，不含路径）")
    @NotBlank
    private String fileName;

    @ApiModelProperty(value = "文件扩展名")
    @Excel(name = "文件扩展名")
    @NotBlank
    private String fileExtension;

    @ApiModelProperty(value = "文件缩略图(包含扩展名，路径复用file_path)")
    @Excel(name = "文件缩略图(包含扩展名，路径复用file_path)")
    @NotBlank
    private String fileThumbnail;

    @ApiModelProperty(value = "文件字节大小")
    @Excel(name = "文件字节大小")
    @NotNull
    private Integer sizeOfBytes;

    @ApiModelProperty(value = "访问次数")
    @Excel(name = "访问次数")
    @NotNull
    private Integer numOfVisit;

    @ApiModelProperty(value = "直接下级数量")
    @Excel(name = "直接下级数量")
    @NotNull
    private Integer numOfChildren;

    @ApiModelProperty(value = "收藏类型(0=未收藏，5=已收藏)")
    @Excel(name = "收藏类型(0=未收藏，5=已收藏)")
    @NotNull
    private Integer favoriteType;

    @ApiModelProperty(value = "关联类型(0=原始资源，1=分享中，5=快捷方式）")
    @Excel(name = "关联类型(0=原始资源，1=分享中，5=快捷方式）")
    @NotNull
    private Integer shortcutType;

    @ApiModelProperty(value = "关联的资源ID")
    @Excel(name = "关联的资源ID")
    @NotNull
    @JsonSerialize(using= ToStringSerializer.class)
    private Long shortcutToResId;

    @ApiModelProperty(value = "乐观锁")
    @Excel(name = "乐观锁")
    @NotNull
    private Integer version;

    @ApiModelProperty(value = "所有者")
    @Excel(name = "所有者")
    @NotNull
    @JsonSerialize(using= ToStringSerializer.class)
    private Long owner;

    @ApiModelProperty(value = "创建人")
    @Excel(name = "创建人")
    @NotNull
    @JsonSerialize(using= ToStringSerializer.class)
    private Long createUser;

    @ApiModelProperty(value = "创建时间")
    @Excel(name = "创建时间")
    @NotNull
    private Date createTime;

    @ApiModelProperty(value = "最新修改人")
    @Excel(name = "最新修改人")
    @NotNull
    @JsonSerialize(using= ToStringSerializer.class)
    private Long updateUser;

    @ApiModelProperty(value = "最新修改时间")
    @Excel(name = "最新修改时间")
    @NotNull
    private Date updateTime;

    @ApiModelProperty(value = "删除类型(0=未删除 5=已删除)")
    @Excel(name = "删除类型(0=未删除 5=已删除)")
    @NotNull
    private Integer deleteType;

    @ApiModelProperty(value = "删除人")
    @Excel(name = "删除人")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long deleteUser;

    @ApiModelProperty(value = "删除时间")
    @Excel(name = "删除时间")
    private Date deleteTime;

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      DocResDTO obj = (DocResDTO) o;
      return Objects.equals(id, obj.id);
    }
    
    @Override
    public int hashCode() {
      return Objects.hashCode(id);
    }
}
